import { Controller } from "../../mvc/core/Controller";
import { Global } from "../../../com/gengine/global/Global";
import { FightTextType } from "../scene/player/type/FightTextType";
import { RolePlayer } from "../scene/player/entity/RolePlayer";
import { AttributeValue } from "../scene/player/AttributeValue";
import { AttributeTextType } from "../scene/player/type/AttributeTextType";
import { ThingUtil } from "../scene/layer/utils/ThingUtil";
import { SpritePlayer } from "../scene/player/entity/SpritePlayer";
import { ItemData } from "../resource/info/ItemData";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { DataEvent } from "../events/DataEvent";
import { EventName } from "../mvc/EventName";
import { SEntityId } from "../../../Message/Public/SEntityId";
import { SPublicMiniPlayer } from "../../../Message/Public/SPublicMiniPlayer";
import { SChatMsg } from "../../../Message/Game/SChatMsg";
import { EChatType } from "../../../Message/Public/EChatType";
import { NetDispatcher } from "../../mvc/core/NetDispatcher";
import { ServerCommand } from "../mvc/ServerCommand";
type int = number;
//class TestController
    
    export  class TestController extends Controller
    {
       

        protected /* override */ initServer(): void
        {
            if (Global.isDebugModle) 
            {
                flash.utils.setTimeout(this.test, 10000);
            }
            return;
        }

        /* internal  */test(): void
        {
            Global.stage.addEventListener(flash.events.Event.ENTER_FRAME, this.onEnterFrame);
            return;
        }

        /* internal  */onEnterFrame(arg1: Object /* flash.events.Event */): void
        {
            this.testMemory();
            return;
        }

        /* internal  */testFightText(): void
        {
            var loc1=FightTextType.SkillName;
            RolePlayer.instance.textEffect("进入战斗", false, FightTextType.FightState);
            RolePlayer.instance.showAttributChange(new AttributeValue(AttributeTextType.jouk, true, 3000));
            return;
        }

        /* internal  */testFight(): void
        {
            var loc1=null;
            var loc2;
            var loc3;
            if ((loc2.fightNum = loc3 = ((loc2 = this).fightNum + 1)) % this.fightInterval != 0) 
            {
                return;
            }
            loc2 = 0;
            loc3 = ThingUtil.entityUtil.allEntitys;
            for(loc1 of loc3) 
            {
                if (typeof !(loc1 === "spriteplayer")) 
                {
                    continue;
                }
            }
            return;
        }

        /* internal  */testFly(): void
        {
            var loc1=new ItemData(11100000);
            Dispatcher.dispatchEvent(new DataEvent(EventName.BackPackAddTaskEntity, loc1));
            return;
        }

        /* internal  */testChat(): void
        {
            var loc1=null;
            loc1 = new SEntityId();
            loc1.id = 5;
            var loc2=new SPublicMiniPlayer();
            loc2.name = "test";
            loc2.sex = 1;
            loc2.camp = 1;
            loc2.level = 60;
            loc2.entityId = loc1;
            loc2.VIP = 9;
            var loc3=new SChatMsg();
            loc3.fromPlayer = loc2;
            loc3.content = "给我一个美女， 我可以创造一个民族/11/11";
            loc3.chatDt = new Date();
            loc3.extend = [];
            loc3.petInfos = [];
            loc3.playerItems = [];
            loc3.chatType = EChatType._EChatTypeWorld;
            NetDispatcher.dispatchCmd(ServerCommand.ChatMessageUpdate, loc3);
            return;
        }

        /* internal  */testMemory(): void
        {
            this.testArena();
            return;
        }

        /* internal  */testArena(): void
        {
            var loc1=0;
            while (loc1 < 20) 
            {
                ++loc1;
            }
            return;
        }

        private /* const */fightInterval: int=10;

        private /* var */fightNum: int=0;
    }
